:root {
  font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  font-weight: 400;

  color-scheme: light dark;
  color: #333;
  background-color: #f5f7fa;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  font-weight: 500;
  color: #646cff;
  text-decoration: inherit;
}
a:hover {
  color: #535bf2;
}

body {
  margin: 0;
  padding: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: #f5f7fa;
  background-image: linear-gradient(120deg, #f5f7fa 0%, #e4eaf5 100%);
}

h1 {
  font-size: 3.2em;
  line-height: 1.1;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: #1a1a1a;
  cursor: pointer;
  transition: border-color 0.25s;
}

button:hover {
  background-color: #3a7bc8;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(74, 144, 226, 0.4);
}

button:focus,
button:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.card {
  padding: 2em;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s, box-shadow 0.3s;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.text-center {
  text-align: center;
}

.mb-3 {
  margin-bottom: 1rem;
}

.mb-5 {
  margin-bottom: 2rem;
}

.icon-lg {
  font-size: 3rem;
  margin-bottom: 1rem;
}

#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.weather-search {
  width: 100%;
  margin-bottom: 2rem;
}

.search-container {
  position: relative;
  display: flex;
  margin-bottom: 2rem;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  transition: all 0.3s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
  border-color: #646cff;
  box-shadow: 0 0 0 2px rgba(100, 108, 255, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-button {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  list-style: none;
  padding: 0.5rem 0;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
}

.suggestions li {
  padding: 0.8rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.suggestions li:hover {
  background-color: #f5f7fa;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-style: italic;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(100, 108, 255, 0.2);
  border-radius: 50%;
  border-top-color: #646cff;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error {
  text-align: center;
  padding: 1rem;
  margin: 1rem 0;
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border-radius: 8px;
  font-weight: 500;
}

/* Weather Container Styles */
.weather-container {
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
  transition: all 0.3s;
}

.weather-sunny {
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  color: #333;
}

.weather-rainy {
  background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
  color: #333;
}

.weather-snowy {
  background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
  color: #333;
}

.weather-cloudy {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
}

.weather-foggy {
  background: linear-gradient(135deg, #e0e5ec 0%, #e0e5ec 100%);
  color: #333;
}

.weather-default {
  background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
  color: #333;
}

.current-weather {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.location-info {
  text-align: center;
  margin-bottom: 1rem;
}

.location-info h2 {
  margin: 0;
  font-size: 1.8rem;
  color: inherit;
  border-bottom: none;
  padding-bottom: 0;
}

.update-time {
  font-size: 0.9rem;
  opacity: 0.8;
  margin: 0.3rem 0 0;
}

.weather-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin: 1rem 0;
}

.temperature {
  display: flex;
  align-items: flex-end;
}

.temp-value {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
}

.temp-unit {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.weather-details {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.weather-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.weather-text {
  font-size: 1.2rem;
  font-weight: 500;
}

.weather-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.metric-icon {
  font-size: 1.5rem;
  color: #4facfe;
}

.metric-info {
  flex: 1;
}

.metric-label {
  font-size: 0.9rem;
  opacity: 0.7;
  margin: 0;
}

.metric-value {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

h3 {
  color: inherit;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  text-align: center;
}

.forecast-container, .history-container {
  margin-top: 1.5rem;
}

.forecast-list, .history-list {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  padding-bottom: 1rem;
  margin: 0;
  list-style: none;
}

.forecast-item, .history-item {
  flex: 0 0 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.forecast-item:hover, .history-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.forecast-date, .history-date {
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

.forecast-icon, .history-icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.forecast-text, .history-text {
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.forecast-temp, .history-temp {
  font-weight: 600;
  font-size: 0.9rem;
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

@media (max-width: 768px) {
  .weather-main {
    flex-direction: column;
    gap: 1rem;
  }
  
  .temp-value {
    font-size: 3.5rem;
  }
  
  .weather-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .weather-metrics {
    grid-template-columns: 1fr;
  }
  
  .search-container {
    flex-direction: column;
  }
  
  .search-button {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color: rgba(255, 255, 255, 0.9);
    background-color: #121212;
    --primary-color: #5b9bf3;
    --light-color: #1e1e1e;
  }
  .card {
    background-color: #1e1e1e;
  }
  body {
    background: linear-gradient(135deg, #121212 0%, #1e1e1e 100%);
  }
  
  .search-input {
    background-color: #2a2a2a;
    border-color: #3a3a3a;
    color: #eee;
  }
  
  .suggestions {
    background-color: #2a2a2a;
  }
  
  .suggestions li:hover {
    background-color: #3a3a3a;
  }
  
  .metric-item, .forecast-item, .history-item {
    background-color: rgba(42, 42, 42, 0.7);
  }
}

/* 添加自定义动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.weather-container {
  animation: fadeInUp 0.5s ease-out forwards;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.dark ::-webkit-scrollbar-track {
  background: #2a2a2a;
}

.dark ::-webkit-scrollbar-thumb {
  background: #555;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #777;
}
